package com.muh.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.Transient;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import org.springframework.data.elasticsearch.annotations.HighlightField;

import java.util.List;

@Data
@Document(indexName = "employee")
@NoArgsConstructor
@AllArgsConstructor
public class Employee {
    //此项作为id，不会写到_source里边。
    @Id
    private Long id;

    @Field(type = FieldType.Text)
    private String name;

    @Field(type = FieldType.Integer)
    private Integer age;

    @Field(type = FieldType.Integer)
    private Integer sex;

    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    @HighlightField
    private String address;

    @Field(type = FieldType.Text)
    private String remark;

    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    @HighlightField
    private String description;


    //高亮字段（非持久化）
    @Transient
    private String highlightAddress;
}
